package demo.android.com.mvpdemo.myRetrofit;

/**
 * Created by Vya on 2018/2/2 0002.
 */

public interface ParameterHandler<T> {
    void apply(RequestBuilder requestBuilder,T value);

    //使用策略模式，query,Part,QueryMap,Filed...
    class Query<T> implements  ParameterHandler<T>{
        private String key; //保存的是参数的key ,userName，passWord
        public Query(String key){
            this.key = key;
        }
        @Override
        public void apply(RequestBuilder requestBuilder,T value) {
            //添加到request中 , value转成String应该使用工厂来创建
            requestBuilder.addQueryName(key,value.toString());
        }
    }
}
